$(function(){
  /**顾客填写页面--成人身份证验证**/
  $('.am-modal-footer').on('click','.certificate-adult-type',function(){
	  var typeName = $(this).text();
	  var passengers = $(this).attr('passengers');
	  var select_card = $(this).parents('dl').find('.adult-certificate')
	  if(passengers == '1'){
		  select_card.addClass('checkcard');
	  }else{
		  select_card.removeClass('checkcard');
	  }
	  $(this).parents('dl').find('.certificate').text(typeName);
	  $(this).parents('dl').find('.adult_passengers').val(passengers);
  });
  
  /**顾客填写页面--小孩身份证验证**/
  $('.am-modal-footer').on('click','.certificate-children-type',function(){
	  var typeName = $(this).text();
	  var passengers = $(this).attr('passengers');
	  var select_card = $(this).parents('dl').find('.children-certificate');
	  if(passengers == '1'){
		  select_card.addClass('checkcard');
	  }else{
		  select_card.removeClass('checkcard');
	  }
	  $(this).parents('dl').find('.certificate').text(typeName);
	  $(this).parents('dl').find('.children_passengers').val(passengers);
  });
  
  /**评论翻页**/
  var page = 2;
  $(window).scroll(function(){
	 var scrollTop = parseFloat($(this).scrollTop());
	 var scrollHeight = parseFloat($(document).height());
	 var windowHeight = parseFloat($(this).height());
	 var count = $('.count').text();
	 var line_id = $('.line-id').text();
	 var url = hostUrl()+'line/lineproduct/ajaxGetLineProductView';
	 if( page <= count ){
		if( scrollTop + windowHeight >= scrollHeight ) {
    	   $.ajax({
    			type:'get',
    			url :url,
    			data:{'page':page,'line_id':line_id},
    		    dataType:'json',
    		    async: false,
    		    beforeSend:function(XMLHttpRequest){ hideShowConvert()},
    		    success:function(json){
    		    	if(json.status){
    		    		$('.product-comment div').last().after(json.content);
    		            page++;
    		    	}
    		     }
    		 })
	    }
	 }
   });
})
  